package com.jjyd.crlp.model.dto.tech;

import com.jjyd.crlp.domain.entity.Dictionary;
import com.jjyd.crlp.domain.entity.type.LanguageType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 添加单词
 */
@Data
@ApiModel("添加单词")
public class WordDto {

    /**
     * 单词主键id
     */
    @ApiModelProperty(value = "单词主键id,如果为新增单词，此id不需要")
    private Integer id;

    /**
     * 目标语言
     */
    @ApiModelProperty(value = "目标语言",required = true)
    private String targetLanguage;

    /**
     * 目标语言类型
     */
    @ApiModelProperty(value = "目标语言类型",required = true)
    private LanguageType targetLanguageType;


    /**
     * 原始语言
     */
    @ApiModelProperty(value = "原始语言",required = true)
    private String originalLanguage;

    /**
     * 原始语言类型
     */
    @ApiModelProperty(value = "原始语言类型",required = true)
    private LanguageType originalLanguageType;

    /**
     * 例句
     */
    @ApiModelProperty(value = "例句")
    private String example;


    /**
     * 转换为字典类型实体类的算法
     * @return
     */
    public Dictionary toDictionary() {
        Dictionary dictionary = new Dictionary();
        dictionary.setId(this.id);
        dictionary.setExample(this.example);
        dictionary.setOriginalLanguage(this.originalLanguage);
        dictionary.setOriginalLanguageType(this.targetLanguageType);
        dictionary.setTargetLanguage(this.targetLanguage);
        dictionary.setTargetLanguageType(targetLanguageType);
        return dictionary;
    }
}
